

%% load in all pre-selected masks:
fn = dir('*_EyeMask.mat');
f = waitbar(0,'Tracking eye movies');
for n = 1:length(fn)
    load(fn(n).name)
    v = VideoReader(movname);
    mov = read(v);
    mov = mov(:,:,1,:);
    mov = reshape(mov,size(mov,1),size(mov,2),size(mov,4));
    savename = strrep(fn(n).name,'EyeMask','EyeTracking');
    [center,radius,metric] = L_trackeye2p(mov,bw);
    save(savename,'movname','center','radius','metric');
    waitbar(n/length(fn),f,'Tracking eye movies');
end
clear v
close(f)